<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Viewport</title>
  <style>
    html,
    body,
    div,
    span,
    h1,
    h2,
    h3 {
      margin: 0;
      padding: 0;
      border: 0;
    }

    .demo {
      width: 100vw;
      font-size: 5vw;
      margin: 0 auto;
      background-color: #50688B;
      color: #FFF;
    }

    .demo2 {
      width: 80vw;
      font-size: 5vw;
      margin: 0 auto;
      background-color: #ff6a00;
    }

    .demo3 {
      width: 50vw;
      height: 50vh;
      font-size: 1vw;
      margin: 0 auto;
      background-color: #ff006e;
      color: #FFF;
    }
  </style>
</head>

<body>
  <div class="demo">
    <h1>宽度100％, 字体5％</h1>
  </div>
  <div class="demo2">
    <h2>宽度80％, 字体5％</h2>
  </div>
  <div class="demo3">
    <h3>宽度50％, 高度50％, 字体1％</h3>
  </div>
</body>

</html>